package com.example.ibsp_demo.mapper.user;

import com.example.ibsp_demo.pojo.dto.perCenter.UserProfileDto;
import com.example.ibsp_demo.pojo.entity.user.User;
import com.example.ibsp_demo.pojo.entity.user.UserProfile;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface UserMapper {


    List<Integer> selectRandomUidsExcept(@Param("currentUid") Integer currentUid,@Param("limit") Integer limit);
    /*
    *
    * 批量查询用户
    *
    * */
    List<User> selectAllByUids(@Param("uids")List<Integer> uids,int limit);

    /*
    * 增加一个通过电话号码查询的方法
    *
    * */
    User selectByPhone(String phone);


    // 基础CRUD方法
    User selectByUid(Integer uid);

    User selectByUsername(String username);
    User selectByEmail(String email);
    List<User> selectAll();
    int insert(User user);
    int updateByUserProfileDto(UserProfileDto dto);
    int updateByUser(User user);

    int deleteByUid(Integer uid);
    // 分页查询
    List<User> selectByPage(Map<String, Object> params);

    // 状态查询
    List<User> selectByStatus(Integer status);
    /**
     * 通过用户名模糊查询用户
     * @param username 用户名关键词
     * @return 匹配的用户列表
     */
    List<User> selectByUsernameLike(@Param("username") String username);

    List<User> selectUsersByConditions(@Param("uid") Integer uid);
    void updateUserStatus(@Param("uid") Integer uid, @Param("status") Integer status);

}